// 设置cookie
function setCookie(key,value,time=3600){
	document.cookie = `${key}=${value};Max-Age=${time}`;
}


// 删除cookie 
function delCookie(key){
	document.cookie = `${key}=;Max-Age=-1`;
}

// 获取cookie
function getCookie(key){
	let str = document.cookie;
	// name=zhangan; age=20;  -->name?
	let arr= str.split("; ");
	// [name=zhangan,age=20];
	for(let i=0;i<arr.length;i++){
		let oneArr = arr[i].split("=");  //[name,zhangsan]
		if(oneArr[0]==key){
			return oneArr[1];
			break;
		}
	}
	
}